import java.io.*;

/**
 * @program: java_zzx
 * @description:
 * @author: zzx
 * @create: 2022-11-07 20:04
 **/
public class test {
    static long length =0;
    public static long copyFile(String name1, String name2) throws IOException {
        BufferedInputStream bs = new BufferedInputStream(new FileInputStream(name1));
        BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(name2));
        byte[] bytes = new byte[8912];
        int len;
        while ((len = bs.read(bytes)) != -1) {
            length +=len;
            bo.write(bytes, 0, len);
        }
        bs.close();
        bo.close();
        return length;
    }

    public static void main(String[] args) throws IOException {
        System.out.println(copyFile("D:\\devolemont\\Java6699\\10Lesson6699\\1.txt",
                "D:\\devolemont\\Java6699\\10Lesson6699\\2.txt"));
    }
}
